<template>
  <van-tabbar v-model="active" @change="handleChange">
    <van-tabbar-item icon="home-o" to="/">主页</van-tabbar-item>
    <van-tabbar-item icon="bell" to="/notification">通知</van-tabbar-item>
    <van-tabbar-item icon="service-o">客服</van-tabbar-item>
    <van-tabbar-item icon="user-o">我的</van-tabbar-item>
  </van-tabbar>
</template>

<script>
export default {
  name: 'TabBar',
  data() {
    return {
      active: 0
    }
  },
  methods: {
    handleChange(index) {
      this.active = index
    }
  },
  created() {
    // 根据当前路由设置激活的标签
    if (this.$route.path === '/notification') {
      this.active = 1
    }
  }
}
</script> 